﻿#pragma once

#include <log4lite/platform_config.h>
#if defined (LOG4LITE_HAVE_WIN32_CONSOLE)

namespace log4lite {

	class Win32DebugAppender : public Appender
	{
	public:
		Win32DebugAppender()
		{
			//
		}

		~Win32DebugAppender()
		{
			destructorImlp();
		}

	protected:
		virtual void close()
		{
			//
		}

	protected:
		void append(const LogItem& item)
		{
			tostringstream buf;
			_layout->formatAndAppend(buf, item);
			tstring sz = buf.str();
			const tchar * s = sz.c_str();
#ifdef CHARSET_UNICODE
			::OutputDebugStringW(s);
#else
			::OutputDebugStringA(s);
#endif
		}
	};

} // namespace log

#endif // LOG4LITE_HAVE_WIN32_CONSOLE